package logic

import (
	"context"

	"jinrigaoping/rpc/sys/internal/svc"
	"jinrigaoping/rpc/sys/sys"

	"github.com/zeromicro/go-zero/core/logx"
)

type SysUserDeleteLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewSysUserDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SysUserDeleteLogic {
	return &SysUserDeleteLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *SysUserDeleteLogic) SysUserDelete(in *sys.SysUserDeleteReq) (*sys.SysUserDeleteRes, error) {

	if err := l.svcCtx.SysUserModel.Delete(l.ctx, in.Id); err != nil {
		logx.Errorf("SysUserDelete id: %d error: %v", in.Id, err)
		return nil, err
	}

	return &sys.SysUserDeleteRes{}, nil
}
